﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ET.ScoreTeacherClient.Views
{
    /// <summary>
    /// WinPWD.xaml 的交互逻辑
    /// </summary>
    public partial class WinPWD : Window
    {
        public WinPWD()
        {
            InitializeComponent();
        }

        private void BtnOK_Click(object sender, RoutedEventArgs e)
        {
            if (this.txtPassword.Password.Trim() != "qwe")
            {
                Brush def = this.btnOK.Background;
                Task.Run(new Action(() =>
                {
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        this.btnOK.Background = Brushes.Red;
                        this.btnOK.Content = "验证失败";
                    }));
                    Thread.Sleep(1000);
                    this.Dispatcher.Invoke(new Action(() =>
                    {
                        this.btnOK.Background = def;
                        this.btnOK.Content = "密码验证";
                    }));
                }));
                return;
            }
            DialogResult = true;
        }
    }
}
